Dialog method and system, electronic device and storage medium

ABSTRACT

The present disclosure provides a dialog method and system, an electronic device and a storage medium, and relates to the field of artificial intelligence (AI) technologies such as deep learning and natural language processing. A specific implementation scheme involves: rewriting a corresponding dialog state based on received dialog information of a user; determining to-be-used dialog action information based on the dialog information of the user and the dialog state; and generating a reply statement based on the dialog information of the user and the dialog action information. According to the present disclosure, the to-be-used dialog action information can be determined based on the dialog information of the user and the dialog state; and then the reply statement is generated based on the dialog action information, thereby providing an efficient dialog scheme.

The present application claims the priority of Chinese PatentApplication No. 202110857894.6, filed on Jul. 28, 2021, with the titleof “DIALOG METHOD AND SYSTEM, ELECTRONIC DEVICE AND STORAGE MEDIUM”. Thedisclosure of the above application is incorporated herein by referencein its entirety.

FIELD OF THE DISCLOSURE

The present disclosure relates to the field of computer technologies, inparticular to the field of artificial intelligence (AI) technologiessuch as deep learning and natural language processing, and specificallyto a dialog method and system, an electronic device and a storagemedium.

BACKGROUND OF THE DISCLOSURE

With the development of the AI technologies, more and more AI-baseddialog systems emerge.

For example, in an existing AI-based dialog system, a dialog intent thatmay be involved during a dialog, possible slots under the intent, and acorresponding response manner may be predefined. During a dialog with auser, the dialog system may detect a slot hit by the dialog of the userbased on the predefined information, identify the user's dialog intent,and respond to the user in a response manner corresponding to the dialogintent.

SUMMARY OF THE DISCLOSURE

The present disclosure provides a dialog method and system, anelectronic device and a storage medium.

According to one aspect of the present disclosure, a dialog method isprovided, wherein the method includes:

-   -   rewriting a corresponding dialog state based on received dialog        information of a user;    -   determining to-be-used dialog action information based on the        dialog information of the user and the dialog state; and    -   generating a reply statement based on the dialog information of        the user and the dialog action information.

According to another aspect of the present disclosure, an electronicdevice is provided, including:

-   -   at least one processor; and    -   a memory communicatively connected with the at least one        processor;    -   wherein the memory stores instructions executable by the at        least one processor, and the instructions are executed by the at        least one processor to enable the at least one processor to        perform a dialog method, wherein the dialog method includes:    -   rewriting a corresponding dialog state based on received dialog        information of a user;    -   determining to-be-used dialog action information based on the        dialog information of the user and the dialog state; and    -   generating a reply statement based on the dialog information of        the user and the dialog action information.

According to still another aspect of the present disclosure, there isprovided a non-transitory computer readable storage medium with computerinstructions stored thereon, wherein the computer instructions are usedfor causing a computer to perform a dialog method, wherein the dialogmethod includes:

-   -   rewriting a corresponding dialog state based on received dialog        information of a user;    -   determining to-be-used dialog action information based on the        dialog information of the user and the dialog state; and    -   generating a reply statement based on the dialog information of        the user and the dialog action information.

According to the technology of the present disclosure, a more efficientdialog scheme is provided.

It should be understood that the content described in this part isneither intended to identify key or significant features of theembodiments of the present disclosure, nor intended to limit the scopeof the present disclosure. Other features of the present disclosure willbe made easier to understand through the following description.

BRIEF DESCRIPTION OF DRAWINGS

The accompanying drawings are intended to provide a better understandingof the solutions and do not constitute limitations on the presentdisclosure. In the drawings,

FIG. 1 is a schematic diagram according to a first embodiment of thepresent disclosure;

FIG. 2 is a schematic diagram according to a second embodiment of thepresent disclosure;

FIG. 3 is an application architecture diagram of a dialog methodaccording to this embodiment;

FIG. 4 is a schematic diagram of an operating state of an intelligentdialog system according to this embodiment;

FIG. 5 is a schematic diagram of an operating principle of theintelligent dialog system according to this embodiment;

FIG. 6 is a schematic diagram according to a third embodiment of thepresent disclosure; and

FIG. 7 is a block diagram of an electronic device configured to performa dialog method according to an embodiment of the present disclosure.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

Exemplary embodiments of the present disclosure are illustrated belowwith reference to the accompanying drawings, which include variousdetails of the present disclosure to facilitate understanding and shouldbe considered only as exemplary. Therefore, those of ordinary skill inthe art should be aware that various changes and modifications can bemade to the embodiments described herein without departing from thescope and spirit of the present disclosure. Similarly, for clarity andsimplicity, descriptions of well-known functions and structures areomitted in the following description.

Obviously, the embodiments described are some of rather than all of theembodiments of the present disclosure. All other embodiments acquired bythose of ordinary skill in the art without creative efforts based on theembodiments of the present disclosure fall within the protection scopeof the present disclosure.

It is to be noted that the terminal device involved in the embodimentsof the present disclosure may include, but is not limited to, smartdevices such as mobile phones, Personal Digital Assistants (PDAs),wireless handheld devices, and Tablet Computers. The display device mayinclude, but is not limited to, devices with a display function such aspersonal computers and televisions.

In addition, the term “and/or” herein is merely an associationrelationship describing associated objects, indicating that threerelationships may exist. For example, A and/or B indicates that thereare three cases of A alone, A and B together, and B alone. Besides, thecharacter “/” herein generally means that associated objects before andafter it are in an “or” relationship.

FIG. 1 is a schematic diagram according to a first embodiment of thepresent disclosure. As shown in FIG. 1 , a dialog method according tothis embodiment may specifically include the following steps.

In S101, a corresponding dialog state is rewritten based on receiveddialog information of a user.

In S102, to-be-used dialog action information is determined based on thedialog information of the user and the dialog state.

In S103, a reply statement is generated based on the dialog informationof the user and the dialog action information.

The dialog method according to this embodiment may be performed by anintelligent dialog system. In this embodiment, a round of dialog betweena user and an intelligent dialog system is taken as an example. In aspecific dialog scenario, the intelligent dialog system first receivesdialog information of the user and rewrites a corresponding dialog statebased on the dialog information of the user. The dialog state in thisembodiment is configured to record information of a current dialog. Therewriting in this embodiment includes operations such as adding,deleting, or modifying. The rewriting is intended to update the dialoginformation to the corresponding dialog state. This step may also beconsidered to normalize the dialog information for subsequent dialogprocessing based on the dialog state. The dialog state in thisembodiment is configured to store current dialog information based onthe intent, for example, an entity or task name corresponding to theintent, characteristics corresponding to the intent in the currentdialog information, and other related information.

Next, the intelligent dialog system may also determine to-be-used dialogaction information based on the dialog information of the user and thedialog state. The dialog action information may be configured toidentify a reply policy to be used in the current dialog. Further, theintelligent dialog system according to this embodiment may also generatea reply statement based on the dialog information of the user and thedialog action information, and feed the reply statement back to the userto realize a dialog.

In practical applications, the intelligent dialog system may complete aplurality of rounds of dialogs with the user in the above manner. In theplurality of rounds of dialogs, the intelligent dialog system isrequired to take the initiative to adopt a dialog policy formed by aplurality of dialog actions to realize a dialog with the user. At thebeginning of the dialog, the dialog information of the user may only bea vague generic requirement. In the plurality of rounds of dialogs,through the dialogs with the intelligent dialog system, the user'sunderstanding of requirement-related background knowledge may beimproved, and the user's exact requirements may be clarified and refinedduring the understanding. Based on this, the intelligent dialog systemaccording to this embodiment can provide decision-making-level andexecution-level advices. Therefore, the intelligent dialog systemaccording to this embodiment may also be called an IntelligentConsultant System (ICS).

With the dialog method in this embodiment, during a dialog with a user,dialog action information can be determined based on dialog informationof the user and a corresponding rewritten dialog state, and a replaystatement can be generated based on the dialog information of the userand the determined dialog action information, so as to realize thedialog with the user, which effectively improves the efficiency of thedialog. Moreover, the user's generic requirements can also be well met,which can effectively improve the user's experience.

FIG. 2 is a schematic diagram according to a second embodiment of thepresent disclosure. As shown in FIG. 2 , a dialog method according tothis embodiment may specifically include the following steps.

In S201, a corresponding intent is extracted based on the receiveddialog information of the user.

The corresponding intent extracted in this step may be directlyextracted from the dialog information of the user or summarized based onthe dialog information of the user.

In use, specifically, the corresponding intent may be extracted based onthe received dialog information of the user by using a pre-trainedrewriting model. For example, for the dialog information of the user,the dialog information of the user may be expressed in the form of avector by using a pre-trained expression model, and the vectorizeddialog information of the user is inputted into the rewriting model. Therewriting model may extract the intent corresponding to the dialoginformation of the user based on the inputted information.

In S202, the corresponding dialog state is acquired based on the intent.

In a specific implementation, this step may include the following steps.

In (a1), it is detected whether the intent is a new intent; if yes, step(b1) is performed; and otherwise, step (d1) is performed.

In (b1), a corresponding intent unit is retrieved from an intentknowledge graph.

In (c1), the corresponding dialog state is created based on theretrieved intent unit.

In (d1), the dialog state corresponding to the intent is retrieved froma historical state library of the user.

A dialog between the user and the intelligent dialog system may includea plurality of rounds of dialogs, and the plurality of rounds of dialogsmay involve only one intent or a plurality of intents. For example, whenthe user is in a bad mood, an intent of chatting with the intelligentdialog system may be just chatting at first to relieve the mood. Byconstantly chatting with the intelligent dialog system, the user may beguided to change the intent and prepare to travel or buy things. In thisembodiment, in order to efficiently manage dialogs, there is a need todetect whether the intent of each piece of dialog information of theuser is a new intent at any time by using the dialog state to manage thedialog information. If yes, there is a need to retrieve a correspondingintent unit from an intent knowledge graph to create a correspondingdialog state. If no, the corresponding dialog state is retrieved from ahistorical state library of the user.

The intent unit in this embodiment is of a three-layer frame unitstructure. The first layer may be a name of an entity or a task. Anentity object is a name of a person, and the name of the task may be aname with a clear task such as travel, buy fruit or book air tickets.The second layer may be classification information related to the entityor task of the first layer. For example, when the entity is a star, theclassification of the second layer may include feature names such assongs, movies and representative works. If the first layer is to buyfruit, the classification of the second layer may include feature namessuch as fruit name, unit price and quantity. If the first layer is tobook air tickets, the classification of the second layer may includefeature names such as airport name and departure time. The third layermay include common expression statements around features of the secondlayer. For example, some sentences with a template function may bestored, such as opening sentences of an entity or a task correspondingto the current intent. In another example, some popular commentstatements related to the entity corresponding to the intent may also bestored.

The dialog state in this embodiment is established based on the intentunit. For example, information may be stored in the form of key-Valuepairs based on box forms. Information of the first layer, the secondlayer and the third layer of the intent unit may be stored. The entityor task of the first layer of the intent unit is stored in the keys, anda specific task or entity name is stored in the corresponding Values.Features in the second layer of the intent unit are all stored in thekeys, and specific content of the corresponding features is stored inthe corresponding Values. When the dialog state is initially createdbased on the intent unit, the dialog state box includes only the valuesof the keys and the values of the corresponding Values are all null.

In addition, optionally, the second layer in the intent unit may alsostore guide items as features. Specifically, specific information of theguide items is stored in the third layer. The guide items are configuredto indicate a set of all next target intent units that may be moved onafter the intent corresponding to the current intent unit is completed.For example, it may be identified by the name of the entity or task inthe first layer of each target intent unit. Correspondingly, when thecorresponding dialog state is created based on the intent unit, theguide item is stored in the Key as a feature, and a corresponding set ofnext target intent units is stored in the dialog state as a Value.

The intent knowledge graph in this embodiment may include a plurality ofintent units, which may be specifically obtained by mining informationof historical dialogs with all users. The guide item in each intent unitmay serve as an edge connecting different intent units.

Dialog states corresponding to all intents involved in all dialogsbetween the user and the intelligent dialog system may be stored in thehistorical state library of the user in this embodiment. Moreover, finalinformation involved in the dialog of the user with the correspondingintent may be recorded in each dialog state. For example, featureinformation such as a name, a unit price, a quantity, a purchaseplatform and corresponding date of the fruit each time the user buys maybe recorded in the intent unit in which the name of the task is to buyfruit.

Regardless of whether the intent corresponding to the dialog informationof the user is a new intent, the dialog state corresponding to thedialog information of the user may be accurately acquired in the abovemanner. Then, the subsequent dialog may be accurately and efficientlyperformed based on the dialog state.

In S203, the acquired dialog state is rewritten based on the dialoginformation; and step S204 is performed.

For example, specifically, if the dialog information involves a featurename of a Key record in the dialog state, feature informationcorresponding to the key in the dialog information may be written to acorresponding Value position in the dialog state. If the dialoginformation involves deleting the previous dialog information based onthe understanding of the dialog information, feature information in theprevious dialog recorded in the dialog state may be deleted. If thedialog information involves modifying the previous dialog information,the feature information in the previous dialog recorded in the dialogstate may be modified.

Specifically, step S202 and step S203 may also be performed in therewriting model.

In S204, to-be-used dialog action information is determined based on thedialog information of the user and the corresponding dialog state; andstep S205 is performed.

For example, this step may specifically include the following manners.

-   -   (1) The to-be-used dialog action information is determined based        on the dialog information of the user and the intent        corresponding to the dialog information recorded in the dialog        state.    -   (2) The to-be-used dialog action information is determined based        on the dialog information of the user, the intent corresponding        to the dialog information recorded in the dialog state and a        dialog guide item recorded in the dialog state.    -   (3) The to-be-used dialog action information is determined based        on the dialog information of the user and the dialog state and        with reference to historical dialog information of a current        dialog of the user, historical memory information of the user        and/or attribute information of the user.

The dialog in this embodiment may be a plurality of rounds of dialogs.The historical information of the current dialog refers to previousinformation of the dialog prior to the current user dialog informationin the current dialog. The historical memory information of the user mayrefer to all historical dialog information of the user prior to thecurrent dialog, including dialogs of intents corresponding to the dialoginformation of the user or dialogs of other intents. The attributeinformation of the user may be some related attribute information of theuser stored according to all the information of historical dialogs withthe user, such as the user's interest, age, graduate school and otherbasic information. In this embodiment, the current dialog information ofthe user, the historical dialog information and the attributeinformation of the user may be stored in a memory module. Regardless ofthe historical dialog information of the user, the historical memoryinformation of the user or the attribute information of the user,acquisition of the user's personal information is authorized by theuser, so as to provide the user with more efficient services.Acquisition, storage and application of such personal information complywith relevant laws and regulations, and do not violate public order andmoral.

It is to be noted that, in the manner (4), information in the dialogstate used in decision-making may be in either (1) or (2).

In this embodiment, the to-be-used dialog action information may bedetermined based on the dialog information of the user and thecorresponding dialog state by using a pre-trained decision-making model.

If the dialog information of the user has a clear intent, for example,“I want to listen to singer X's song Y”, the to-be-used dialog actioninformation may be determined based on the dialog information of theuser and the intent recorded in the dialog state. In this case, thecorresponding dialog action information may be: Play singer X's song Y.

In addition, if the dialog information of the user indicates that thetask of the current intent has been completed, for example, the dialoginformation of the user is “OK, I see”, it may be determined accordingto the dialog information of the user that the current intent has beencompleted, and the to-be-used dialog action information may bedetermined based on the intent corresponding to the dialog informationrecorded in the dialog state and the dialog guide item recorded in thedialog state. The dialog action information in this case may be policyinformation initiated based on the dialog guide item recorded in thedialog state, which may actively guide the user to start another type ofdialogs. In this manner, after the user completes one thing, theintelligent dialog system may also actively guide the user to do anotherthing, which further enriches the function of the intelligent dialogsystem and improves an effect of dialoguing with the user.

Moreover, further, the intelligent dialog system may also refer to thehistorical dialog information of the user recorded in the dialog statewhen determining the to-be-used dialog action information, so that theuser can be guided more effectively. For example, the dialog informationof the user is “I want to buy some apples”. The intelligent dialogsystem extracts the user's intent in this dialog being to buy apples,and may find from the historical dialog information of the user that theuser has purchased Fuji apples before. In this case, the used dialogaction information determined may be “Ask the user whether to still buyFuji apples”.

Further, when any of the above dialog action information is used fordecision-making, reference may also be made to the historical dialoginformation of the current dialog of the user, the historical memoryinformation of the user and/or the attribute information of the user, soas to determine the dialog action information more intelligently,reasonably and effectively.

In addition, optionally, it may also be detected in real time during thedialog with the user whether the dialog action information of the userincludes attribute information of the user. If yes, the attributeinformation of the user is stored in the memory module. Some detectionrules may be configured for the detection of the attribute information.For example, a field name of the attribute information or a rule thatthe attribute information conforms to may be configured, so as to detectthe attribute information effectively.

In S205, a reply statement is generated based on the dialog informationof the user and the dialog action information.

In this embodiment, to enable the generated reply statement to be morenatural and coherent with the context, the reply statement may begenerated by referring to the dialog information of the user and thedialog action information. Further, in order to enrich a corpus requiredfor generating the reply statement, in this embodiment, on the basis ofreferring to the dialog information of the user and the dialog actioninformation, the reply statement may be further generated by referringto the intent unit corresponding to the intent of the dialog informationof the user. For example, the reply statement may be generated byreferring to a common expression statement stored in the third layer ofthe intent unit corresponding to the intent of the dialog information ofthe user, so that the generated reply statement is more natural andricher in content.

Specifically, the reply statement may be generated based on the dialoginformation of the user and the dialog action information by using apre-trained reply generation model.

In this embodiment, by using the rewriting model, the decision-makingmodel and the reply generation model, the dialog capability of theintelligent dialog system may be further enhanced and the effect ofdialoguing with the user may be improved.

It is to be noted that, in the embodiment of the present disclosure, theintelligent dialog system may acquire the dialog information of the userin various open and legal manners, which may be, for example, acquiredfrom public data sets or acquired from the user with the user'sauthorization. The dialog process in the embodiment of the presentdisclosure is performed after the user's authorization, and itsgeneration process complies with relevant laws and regulations. Thedialog in the embodiment of the present disclosure is not aimed at aspecific user.

For example, FIG. 3 is an application architecture diagram of a dialogmethod according to this embodiment. Referring to FIG. 3 and stepsS201-S205, a main structure of the intelligent dialog system to performthe functions of steps S201-S205 may be placed in a central control partof the intelligent dialog system. That is, the pre-trained rewritingmodel, decision-making model and reply generation model are allintegrated into the central control of the intelligent dialog system. Anintent knowledge graph module and the memory module may be placed in theintelligent dialog system, or placed outside the intelligent dialogsystem, provided that they are accessible to the intelligent dialogsystem at any time and related information can be acquired. As shown inFIG. 3 , when receiving the dialog information of the user, i.e.,Utterance, the central control of the intelligent dialog system firstperforms Natural Language Understanding (NLU) to understand the dialoginformation of the user. Then, a policy may be determined according tosteps S201-S204, and the to-be-used dialog action information may bedetermined. Then, a reply statement Response is generated based on aNatural Language Generation (NLG) technology according to step S205. Inthe process of determining the policy, reference may be made to thedialog state and the attribute information of the user that includes auser portrait and historical preferences and is stored in the memorymodule. The dialog state is created based on an intent unit retrievedfrom the intent knowledge graph module. During the dialog with the user,all the dialog information is stored in the memory module in real time.Therefore, all the dialog information of each dialog of the user withthe intelligent dialog system may be stored in the memory module. If theuser is currently having a dialog with the intelligent dialog system,all the dialog information in the current dialog and prior to thecurrent dialog information may also be stored, as well as the attributeinformation of the user extracted based on all the historical dialoginformation of the user.

For example, FIG. 4 is a schematic diagram of an operating state of anintelligent dialog system according to this embodiment. As shown in FIG.4 , in order to facilitate effective management of dialog states,different types of dialogs in each domain correspond to a dialog statebox. Each dialog state may adopt a multi-layer frame structure in aKey-Value storage manner, which may also be called a frame box. As shownin the left part of FIG. 4 , subject chat under a film domain andquestion and answer under a tourism domain each correspond to a framebox. In combination with the description in the above embodiments, eachframe box corresponds to an entity or a task, and each frame boxincludes a guide item, such as a guidance target as shown in FIG. 4 ,configured to indicate a set of next frames that may be moved on afterthe current frame is completed, corresponding to edges between differentframes. The right part of FIG. 4 is a schematic diagram of operation ofthe central control of the intelligent dialog system. As can be seen, asthe dialog with the user proceeds, the central control also maintains adialog state changing diagram formed by frame state diagrams. Each framestate corresponds to a dialog state. For example, if the intentcorresponding to the dialog information of the user is a new intent,which corresponds to the state transition step 1 in FIG. 4 , in which anew frame box is added. In this case, an intent unit corresponding tothe intent is retrieved from an intent knowledge graph, and then a framebox is created based on the intent unit. Next, in the state transitionstep 2 in FIG. 4 , dynamic state management for the current frame box isinvolved. The dynamic state management in this embodiment involvesadding, deleting and modifying the content in the frame box. In thestate transition step 3 in FIG. 4 , it is assumed that one type ofdialog with the user involves another type of dialog. If another type ofdialog is completed, return to the previous type of dialog.Correspondingly, in the central control of the intelligent dialogsystem, since each type of dialog corresponds to a frame box, a state ofthe frame box also returns to the previous frame box. In the statetransition step 4 in FIG. 4 , when the question and answer is completed,the intelligent dialog system can actively guide the user to the nextframe box based on the guidance target in the current frame box.

In this embodiment, strong central control of the intelligent dialogsystem is realized by using machine learning models such as therewriting model, the decision-making model and the reply generationmodel.

FIG. 5 is a schematic diagram of an operating principle of theintelligent dialog system according to this embodiment. As shown in FIG.5 , the state transition in FIG. 4 is described by taking 4 dialogstates 0, 1, 2, 3 in its upper left corner as examples. The state 0 maybe considered as a ready state. The user first conducts a dialog in thestate 1 with the intelligent dialog system, transitions to a dialog inthe state 2 during the dialog in the state 1, returns to the dialog inthe state 1 after the dialog in the state 2 is completed, and continuesa dialog in the state 3 after the dialog in the state 1 is completed.Each state corresponds to an intent, that is, to a frame, so each statemay also be called a frame state. In this embodiment, each statecorresponds to a task. In this manner, the same task may be invokedmultiple times and managed in a frame, so as to ensure a more effectivedialog with the user.

In combination with the descriptions of steps S201-S205 in the aboveembodiment, the operations of the rewriting model, the decision-makingmodel and the reply generation model may be realized in each framestate. For example, refer to the lower left corner shown in FIG. 5 . Ineach frame state, the rewriting model, the decision-making model and thereply generation model corresponding thereto may be trained. Therewriting model may also be called a writer, the decision-making modelmay also be called an action selection policy, and the reply generationmodel may also be called a generator. As shown in the lower left cornerof FIG. 5 , the rewriting model, the decision-making model and the replygeneration model corresponding to the state 1 may be W1, P1 and G1respectively, the rewriting model, the decision-making model and thereply generation model corresponding to the state 2 may be W2, P2 and G2respectively, and the rewriting model, the decision-making model and thereply generation model corresponding to the state 3 may be W3, P3 and G3respectively. As shown on the right of FIG. 5 , after the dialoginformation of the user, i.e., the Utterance, is received, the Utteranceis first vectorized by using an expression model and then inputted tothe rewriting model W3, and the rewriting model W3 first extracts anintent of the dialog information of the user, acquires a correspondingdialog state frame based on the intent, and rewrites the dialog stateframe based on the dialog information. The vectorized dialog informationand the rewritten dialog state frame are inputted to the decision-makingmodel P3. The decision-making model P3 may select an action based on theinputted information, that is, dialog action information to be used forthe dialog information. Finally, the vectorized dialog information andthe selected action are inputted to the reply generation model G3 toallow the reply generation model G3 to generate a reply statementResponse.

It is to be noted that the intelligent dialog system in this embodimentmay be designed as an end-to-end model. The dialog state frames ofdifferent intents may share a rewriting model, a decision-making modeland a reply generation model. Alternatively, the rewriting models, thedecision-making models and the reply generation models of the dialogstate frames of different intents are the same in structure, but haveindependent specific parameters. That is, the rewriting model, thedecision-making model and the reply generation model corresponding tothe dialog state frame of each intent are trained separately.

The decision-making model and the reply generation model in thisembodiment may be realized by using a Discrete Variational Auto-Encoder(DVAE).

Based on the above, it may be known that the dialog method according tothe present disclosure may assist decision-making and implementation ofthe generic requirements of the user based on active and multi-typedialogs. For example, after the user has an initial requirement, throughthe communication with the intelligent dialog system, the user'sunderstanding of requirement-related background knowledge may beimproved, and the user's exact requirements may be clarified and refinedduring the understanding. This process may inevitably involve many typesof dialogs, including general small talks, question and answer, thematicin-depth chats, and task oriented dialogs. In addition, in order to makethe whole process more efficient, the intelligent dialog systemaccording to the present disclosure also has the capability to activelyguide the dialog, to meet the user's requirements in a one-stop manner.

For example, Table 1 below shows a plurality of rounds of dialogsrealized between a user and the intelligent dialog system by using thetechnical solution in the embodiment shown in FIG. 2 , in which userdenotes dialog information of the user, and bot denotes a replystatement of the intelligent dialog system.

Table 1

-   user The school holiday is coming and I want to go out to climb a    mountain-   bot I also like to climb mountains. I know many famous mountains and    great rivers-   user Do you know Mount Huangshan-   bot Yes, I certainly know. Mount Huangshan has four uniques, strange    pines, absurd stones, sea of clouds and hot springs. How comfortable    it is to climb the mountain and soak in a hot spring-   user Ha-ha, I'm a little touched by what you said. Please buy a    ticket for me.-   bot Ok, when do you want to go-   user The day after tomorrow. School was out then-   bot May I have your ID number, please?-   user****-   bot Ok, I've got it. Do you need to see the weather of Mount    Huangshan?-   user By the way, what's the weather like in Mount Huangshan in the    next few days-   bot There will be showers at Mount Huangshan the day after tomorrow.    Mount Huangshan will begin to turn cloudy three days from now-   user I think I'll go there three days from now-   bot Ok, can I help you change the ticket of the scenic spot?-   user Ok-   bot It has been modified. Please confirm the order

Based on the dialog shown in the table above, it may be known that theuser's initial requirement is a generic requirement. With the in-depthchat with the intelligent dialog system, the user may be actively guidedto help the user to clarify his/her requirement more accurately, whichreally helps the user to solve problems and effectively improves theuser's experience.

The rewriting model, the decision-making model and the reply generationmodel in this embodiment may be trained in a supervised or unsupervisedmanner. The two training manners may also be combined. First, the threemodels may be trained as a whole at the same time in a supervisedmanner, and then each model is trained separately in an unsupervisedmanner. For example, unsupervised training may be performed by using thetraining data as described in Table 1 above. During the training,parameters of the three models are adjusted by using only one lossfunction. In addition, in the supervised training, annotation data maybe added to train each model separately. For example, if the rewritingmodel is to be trained in a supervised manner, an intent correspondingto the dialog information of the user may be annotated to train anintent extraction capability of the rewriting model. If thedecision-making model is to be trained in a supervised manner,to-be-used dialog action information corresponding to the dialoginformation of the user may be annotated to train a decision-makingcapability of the decision-making model. In this case, the three modelscorrespond to three loss functions, and may be trained separately ortrained together. Refer to relevant model training knowledge fordetails, which are not described herein.

With the dialog method according to this embodiment, by using the abovesolution, dialog action information may be determined, and the user maybe actively guided to have a dialog, which further enriches functions ofthe dialog, improves the efficiency of the dialog, can also well meetthe user's generic requirement, and can effectively improve the user'sexperience. Moreover, the dialog method according to this embodiment maybe implemented by using a rewriting model, a decision-making model and areply generation model, which can further improve the intelligence ofthe dialog.

FIG. 6 is a schematic diagram according to a third embodiment of thepresent disclosure. As shown in FIG. 6 , this embodiment provides anintelligent dialog system 600, including:

-   -   a rewriting module 601 configured to rewrite a corresponding        dialog state based on received dialog information of a user;    -   a decision-making module 602 configured to determine to-be-used        dialog action information based on the dialog information of the        user and the dialog state; and    -   a reply generation module 603 configured to generate a reply        statement based on the dialog information of the user and the        dialog action information.

The implementation principle and the technical effect of implementing adialog by using the above modules in the intelligent dialog system 600according to this embodiment are the same as those in the above relatedmethod embodiment. Refer to the descriptions of the above related methodembodiment for details, which are not described in detail herein.

Further optionally, in the intelligent dialog system according to thisembodiment, the rewriting module 601 is further configured to:

-   -   extract a corresponding intent based on the dialog information        of the user; and    -   acquire the corresponding dialog state based on the intent.

Further optionally, in the intelligent dialog system according to thisembodiment, the rewriting module 601 is configured to:

-   -   detect whether the intent is a new intent;    -   retrieve a corresponding intent unit from an intent knowledge        graph if yes; and    -   create the corresponding dialog state based on the intent unit.

Further optionally, in the intelligent dialog system according to thisembodiment, the rewriting module 601 is configured to:

-   -   retrieve the dialog state corresponding to the intent from a        historical state library of the user if the intent is not a new        intent.

Further optionally, in the intelligent dialog system according to thisembodiment, the decision-making module 602 is configured to:

-   -   determine the to-be-used dialog action information based on the        dialog information of the user and the intent corresponding to        the dialog information recorded in the dialog state; or    -   determine the to-be-used dialog action information based on the        dialog information of the user, the intent corresponding to the        dialog information recorded in the dialog state and a dialog        guide item recorded in the dialog state.

Further optionally, in the intelligent dialog system according to thisembodiment, the decision-making module 602 is configured to:

-   -   determine the to-be-used dialog action information based on the        dialog information of the user and the dialog state and with        reference to historical dialog information of a current dialog        of the user, historical memory information of the user and/or        attribute information of the user.

Further optionally, in the intelligent dialog system according to thisembodiment, the rewriting module 601 is configured to:

-   -   rewrite a corresponding dialog state based on the received        dialog information of the user by using a pre-trained rewriting        model;    -   the decision-making module 602 is configured to:    -   determine to-be-used dialog action information based on the        dialog information of the user and the dialog state by using a        pre-trained policy model; and/or    -   the reply generation module 603 is configured to:    -   generate a reply statement based on the dialog information of        the user and the dialog action information by using a        pre-trained reply generation model.

Acquisition, storage and application of users' personal informationinvolved in the technical solutions of the present disclosure, such asacquisition, storage and application of dialog information of the users,comply with relevant laws and regulations, and do not violate publicorder and moral.

According to embodiments of the present disclosure, the presentdisclosure further provides an electronic device, a readable storagemedium and a computer program product.

FIG. 7 is a schematic block diagram of an exemplary electronic device700 configured to implement embodiments of the present disclosure. Theelectronic device is intended to represent various forms of digitalcomputers, such as laptops, desktops, workbenches, PDAs, servers, bladeservers, mainframe computers and other suitable computing devices. Theelectronic device may further represent various forms of mobile devices,such as PDAs, cellular phones, smart phones, wearable devices and othersimilar computing devices. The components, their connections andrelationships, and their functions shown herein are examples only, andare not intended to limit the implementation of the present disclosureas described and/or required herein.

As shown in FIG. 7 , the device 700 includes a computing unit 701, whichmay perform various suitable actions and processing according to acomputer program stored in a read-only memory (ROM) 702 or a computerprogram loaded from a storage unit 708 into a random access memory (RAM)703. The RAM 703 may also store various programs and data required tooperate the device 700. The computing unit 701, the ROM 702 and the RAM703 are connected to one another by a bus 704. An input/output (I/O)interface 705 is also connected to the bus 704.

A plurality of components in the device 700 are connected to the I/Ointerface 705, including an input unit 706, such as a keyboard and amouse; an output unit 707, such as various displays and speakers; astorage unit 708, such as disks and discs; and a communication unit 709,such as a network card, a modem and a wireless communicationtransceiver. The communication unit 709 allows the device 700 toexchange information/data with other devices over computer networks suchas the Internet and/or various telecommunications networks.

The computing unit 701 may be a variety of general-purpose and/orspecial-purpose processing components with processing and computingcapabilities. Some examples of the computing unit 701 include, but arenot limited to, a central processing unit (CPU), a graphics processingunit (GPU), various artificial intelligence (AI) computing chips,various computing units that run machine learning model algorithms, adigital signal processor (DSP), and any appropriate processor,controller or microcontroller, etc. The computing unit 801 performs themethods and processing described above, such as the dialog method. Forexample, in some embodiments, the dialog method may be implemented as acomputer software program that is tangibly embodied in amachine-readable medium, such as the storage unit 708. In someembodiments, part or all of a computer program may be loaded and/orinstalled on the device 700 via the ROM 702 and/or the communicationunit 709. One or more steps of the dialog method described above may beperformed when the computer program is loaded into the RAM 703 andexecuted by the computing unit 701. Alternatively, in other embodiments,the computing unit 701 may be configured to perform the dialog method byany other appropriate means (for example, by means of firmware).

Various implementations of the systems and technologies disclosed hereincan be realized in a digital electronic circuit system, an integratedcircuit system, a field programmable gate array (FPGA), anapplication-specific integrated circuit (ASIC), an application-specificstandard product (ASSP), a system on chip (SOC), a complex programmablelogic device (CPLD), computer hardware, firmware, software, and/orcombinations thereof. Such implementations may include implementation inone or more computer programs that are executable and/or interpretableon a programmable system including at least one programmable processor,which can be special or general purpose, configured to receive data andinstructions from a storage system, at least one input apparatus, and atleast one output apparatus, and to transmit data and instructions to thestorage system, the at least one input apparatus, and the at least oneoutput apparatus.

Program codes configured to implement the methods in the presentdisclosure may be written in any combination of one or more programminglanguages. Such program codes may be supplied to a processor orcontroller of a general-purpose computer, a special-purpose computer, oranother programmable data processing apparatus to enable thefunction/operation specified in the flowchart and/or block diagram to beimplemented when the program codes are executed by the processor orcontroller. The program codes may be executed entirely on a machine,partially on a machine, partially on a machine and partially on a remotemachine as a stand-alone package, or entirely on a remote machine or aserver.

In the context of the present disclosure, machine-readable media may betangible media which may include or store programs for use by or inconjunction with an instruction execution system, apparatus or device.The machine-readable media may be machine-readable signal media ormachine-readable storage media. The machine-readable media may include,but are not limited to, electronic, magnetic, optical, electromagnetic,infrared, or semiconductor systems, apparatuses or devices, or anysuitable combinations thereof. More specific examples ofmachine-readable storage media may include electrical connections basedon one or more wires, a portable computer disk, a hard disk, an RAM, anROM, an erasable programmable read only memory (EPROM or flash memory),an optical fiber, a compact disk read only memory (CD-ROM), an opticalstorage device, a magnetic storage device, or any suitable combinationthereof.

To provide interaction with a user, the systems and technologiesdescribed here can be implemented on a computer. The computer has: adisplay apparatus (e.g., a cathode-ray tube (CRT) or a liquid crystaldisplay (LCD) monitor) for displaying information to the user; and akeyboard and a pointing apparatus (e.g., a mouse or trackball) throughwhich the user may provide input for the computer. Other kinds ofapparatuses may also be configured to provide interaction with the user.For example, a feedback provided for the user may be any form of sensoryfeedback (e.g., visual, auditory, or tactile feedback); and input fromthe user may be received in any form (including sound input, speechinput, or tactile input).

The systems and technologies described herein can be implemented in acomputing system including background components (e.g., as a dataserver), or a computing system including middleware components (e.g., anapplication server), or a computing system including front-endcomponents (e.g., a user computer with a graphical user interface or webbrowser through which the user can interact with the implementation modeof the systems and technologies described here), or a computing systemincluding any combination of such background components, middlewarecomponents or front-end components. The components of the system can beconnected to each other through any form or medium of digital datacommunication (e.g., a communication network). Examples of thecommunication network include: a local area network (LAN), a wide areanetwork (WAN) and the Internet.

The computer system may include a client and a server. The client andthe server are generally far away from each other and generally interactvia the communication network. A relationship between the client and theserver is generated through computer programs that run on acorresponding computer and have a client-server relationship with eachother. The server may be a cloud server, a distributed system server, ora server combined with blockchain.

It should be understood that the steps can be reordered, added, ordeleted using the various forms of processes shown above. For example,the steps described in the present disclosure may be executed inparallel or sequentially or in different sequences, provided thatdesired results of the technical solutions disclosed in the presentdisclosure are achieved, which is not limited herein.

The above specific implementations do not limit the protection scope ofthe present disclosure. Those skilled in the art should understand thatvarious modifications, combinations, sub-combinations, and replacementscan be made according to design requirements and other factors. Anymodifications, equivalent substitutions and improvements made within thespirit and principle of the present disclosure all should be included inthe protection scope of the present disclosure.

What is claimed is:
 1. A dialog method, wherein the method comprises:rewriting a corresponding dialog state based on received dialoginformation of a user; determining to-be-used dialog action informationbased on the dialog information of the user and the dialog state; andgenerating a reply statement based on the dialog information of the userand the dialog action information.
 2. The method according to claim 1,wherein, prior to the step of rewriting a corresponding dialog statebased on received dialog information of a user, the method furthercomprises: extracting a corresponding intent based on the dialoginformation of the user; and acquiring the corresponding dialog statebased on the intent.
 3. The method according to claim 2, wherein thestep of acquiring the corresponding dialog state based on the intentcomprises: detecting whether the intent is a new intent; retrieving acorresponding intent unit from an intent knowledge graph if the intentis a new intent; and creating the corresponding dialog state based onthe intent unit.
 4. The method according to claim 2, wherein the step ofacquiring the corresponding dialog state based on the intent furthercomprises: retrieving the dialog state corresponding to the intent froma historical state library of the user if the intent is not a newintent.
 5. The method according to claim 3, wherein the step ofacquiring the corresponding dialog state based on the intent furthercomprises: retrieving the dialog state corresponding to the intent froma historical state library of the user if the intent is not a newintent.
 6. The method according to claim 1, wherein the step ofdetermining to-be-used dialog action information based on the dialoginformation of the user and the dialog state comprises: determining theto-be-used dialog action information based on the dialog information ofthe user and the intent corresponding to the dialog information recordedin the dialog state; or determining the to-be-used dialog actioninformation based on the dialog information of the user, the intentcorresponding to the dialog information recorded in the dialog state anda dialog guide item recorded in the dialog state.
 7. The methodaccording to claim 2, wherein the step of determining to-be-used dialogaction information based on the dialog information of the user and thedialog state comprises: determining the to-be-used dialog actioninformation based on the dialog information of the user and the intentcorresponding to the dialog information recorded in the dialog state; ordetermining the to-be-used dialog action information based on the dialoginformation of the user, the intent corresponding to the dialoginformation recorded in the dialog state and a dialog guide itemrecorded in the dialog state.
 8. The method according to claim 3,wherein the step of determining to-be-used dialog action informationbased on the dialog information of the user and the dialog statecomprises: determining the to-be-used dialog action information based onthe dialog information of the user and the intent corresponding to thedialog information recorded in the dialog state; or determining theto-be-used dialog action information based on the dialog information ofthe user, the intent corresponding to the dialog information recorded inthe dialog state and a dialog guide item recorded in the dialog state.9. The method according to claim 4, wherein the step of determiningto-be-used dialog action information based on the dialog information ofthe user and the dialog state comprises: determining the to-be-useddialog action information based on the dialog information of the userand the intent corresponding to the dialog information recorded in thedialog state; or determining the to-be-used dialog action informationbased on the dialog information of the user, the intent corresponding tothe dialog information recorded in the dialog state and a dialog guideitem recorded in the dialog state.
 10. The method according to claim 6,wherein the step of determining to-be-used dialog action informationbased on the dialog information of the user and the dialog statecomprises: determining the to-be-used dialog action information based onthe dialog information of the user and the dialog state and withreference to historical dialog information of a current dialog of theuser, historical memory information of the user and/or attributeinformation of the user.
 11. The method according to claim 1, whereinthe step of rewriting a corresponding dialog state based on receiveddialog information of a user comprises: rewriting the correspondingdialog state based on the received dialog information of the user byusing a pre-trained rewriting model; the step of determining to-be-useddialog action information based on the dialog information of the userand the dialog state comprises: determining the to-be-used dialog actioninformation based on the dialog information of the user and the dialogstate by using a pre-trained policy model; and/or the step of generatinga reply statement based on the dialog information of the user and thedialog action information comprises: generating the reply statementbased on the dialog information of the user and the dialog actioninformation by using a pre-trained reply generation model.
 12. Anelectronic device, comprising: at least one processor; and a memorycommunicatively connected with the at least one processor; wherein thememory stores instructions executable by the at least one processor, andthe instructions are executed by the at least one processor to enablethe at least one processor to perform a dialog method, wherein thedialog method comprises: rewriting a corresponding dialog state based onreceived dialog information of a user; determining to-be-used dialogaction information based on the dialog information of the user and thedialog state; and generating a reply statement based on the dialoginformation of the user and the dialog action information.
 13. Theelectronic device according to claim 12, wherein, prior to the step ofrewriting a corresponding dialog state based on received dialoginformation of a user, the method further comprises: extracting acorresponding intent based on the dialog information of the user; andacquiring the corresponding dialog state based on the intent.
 14. Theelectronic device according to claim 13, wherein the step of acquiringthe corresponding dialog state based on the intent comprises: detectingwhether the intent is a new intent; retrieving a corresponding intentunit from an intent knowledge graph if the intent is a new intent; andcreating the corresponding dialog state based on the intent unit. 15.The electronic device according to claim 13, wherein the step ofacquiring the corresponding dialog state based on the intent furthercomprises: retrieving the dialog state corresponding to the intent froma historical state library of the user if the intent is not a newintent.
 16. The electronic device according to claim 14, wherein thestep of acquiring the corresponding dialog state based on the intentfurther comprises: retrieving the dialog state corresponding to theintent from a historical state library of the user if the intent is nota new intent.
 17. The electronic device according to claim 12, whereinthe step of determining to-be-used dialog action information based onthe dialog information of the user and the dialog state comprises:determining the to-be-used dialog action information based on the dialoginformation of the user and the intent corresponding to the dialoginformation recorded in the dialog state; or determining the to-be-useddialog action information based on the dialog information of the user,the intent corresponding to the dialog information recorded in thedialog state and a dialog guide item recorded in the dialog state. 18.The electronic device according to claim 17, wherein the step ofdetermining to-be-used dialog action information based on the dialoginformation of the user and the dialog state comprises: determining theto-be-used dialog action information based on the dialog information ofthe user and the dialog state and with reference to historical dialoginformation of a current dialog of the user, historical memoryinformation of the user and/or attribute information of the user. 19.The electronic device according to claim 12, wherein the step ofrewriting a corresponding dialog state based on received dialoginformation of a user comprises: rewriting the corresponding dialogstate based on the received dialog information of the user by using apre-trained rewriting model; the step of determining to-be-used dialogaction information based on the dialog information of the user and thedialog state comprises: determining the to-be-used dialog actioninformation based on the dialog information of the user and the dialogstate by using a pre-trained policy model; and/or the step of generatinga reply statement based on the dialog information of the user and thedialog action information comprises: generating the reply statementbased on the dialog information of the user and the dialog actioninformation by using a pre-trained reply generation model.
 20. Anon-transitory computer readable storage medium with computerinstructions stored thereon, wherein the computer instructions are usedfor causing a computer to perform a dialog method, wherein the dialogmethod comprises: rewriting a corresponding dialog state based onreceived dialog information of a user; determining to-be-used dialogaction information based on the dialog information of the user and thedialog state; and generating a reply statement based on the dialoginformation of the user and the dialog action information.